package de.mnit.basis.swt.element;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Widget;


/**
 * @author Michael Nitsche
 */
public abstract class A_SWT_Element<TA extends A_SWT_Element<?,?>, TB extends Widget> extends A_SWT_Element_Basis<TA,TB> {

	public boolean gFreigegeben() {
		return swt().isDisposed();
	}

	public void freigeben() {
		swt().dispose();
	}

	public void eAuswahl(Listener aktion) {
		this.swt().addListener(SWT.Selection, aktion);
	}

	public void eFreigabe(Listener aktion) {
		this.swt().addListener(SWT.Dispose, aktion);
	}

	// ERZEUGEN

	protected final void init1() {
		init2();
	}

	protected final int style1() {
		return style2();
	}

	protected abstract int style2();
	protected abstract void init2();

}
